var axios = require('../../../index');
var http = require('http');
var net = require('net');
var url = require('url');
var zlib = require('zlib');
var assert = require('assert');
var fs = require('fs');
var path = require('path');
var server, proxy;

describe('supports http with nodejs', function () {

  afterEach(function () {
    if (server) {
      server.close();
      server = null;
    }
    if (proxy) {
      proxy.close()
      proxy = null;
    }
    if (process.env.http_proxy) {
      delete process.env.http_proxy;
    }
    if (process.env.no_proxy) {
      delete process.env.no_proxy;
    }
  });

  it('should respect the timeout property', function (done) {

    console.log("test")
    done()
    // server = http.createServer(function (req, res) {
    //   setTimeout(function () {
    //     res.end();
    //   }, 1000);
    // }).listen(4444, function () {
    //   var success = false, failure = false;
    //   var error;

    //   axios.get('http://localhost:4444/', {
    //     timeout: 250
    //   }).then(function (res) {
    //     success = true;
    //   }).catch(function (err) {
    //     error = err;
    //     failure = true;
    //   });

    //   setTimeout(function () {
    //     assert.equal(success, false, 'request should not succeed');
    //     assert.equal(failure, true, 'request should fail');
    //     assert.equal(error.code, 'ECONNABORTED');
    //     assert.equal(error.message, 'timeout of 250ms exceeded');
    //     done();
    //   }, 300);
    // });
  });

});

